﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using BaiTu.Framework;
using BaiTu.IOCServices;
 
using BaiTu.ILogging;
using Autofac;
using BaiTu.Logging.Dependency;

namespace BaiTu.IOCServices.Testing
{
    [TestClass]
    public class UnitTest1
    {

        [TestMethod]
        public void TestMethod1()
        {

            try
            {
                EngineContext.Initialize(false);

            }
            catch (Exception ex)
            {

            }
            try
            {
                ILogger ll = EngineContext.Current.Resolve<Logging.BaiTuLog4netLogger>();
                Thing thing = EngineContext.Current.Resolve<Thing>();

                thing.Logger.Log(ILogging.LogLevel.Fatal, null, "111111111111111111", null);
                Assert.AreEqual(0, 0);
            }
            catch (Exception ex)
            {

            }
        }

        public void Register(ContainerBuilder builder, Framework.Core.TypeFinder.ITypeFinder typeFinder)
        {
            builder.RegisterType<UnitTest1>();
        }

        public int Order
        {
            get { return 200; }
        }
    }
    public class Thing : IOCServices.IDependencyRegistrater
    {
        public ILogger Logger { get; set; }

        public Thing()
        {
            Logger = Logging.NullLogger.Instance;

        }

        public void Register(ContainerBuilder builder, Framework.Core.TypeFinder.ITypeFinder typeFinder)
        {
            builder.RegisterType<Thing>();
        }

        public int Order
        {
            get { return 200; }
        }
    }


}
